package com.gqz.jbox2d

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
import androidx.core.app.ComponentActivity.ExtraData
import androidx.core.content.ContextCompat.getSystemService
import android.icu.lang.UCharacter.GraphemeClusterBreak.T
import org.jbox2d.pooling.arrays.IntArray
import kotlin.system.measureTimeMillis


class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        var time = measureTimeMillis {
            calc()
        }

        main_tv.text = ""+ time + "\n" + test()
    }

    fun calc() {
        var a = 1
        var b: Long = 1
        var c = 1.0f
        var d = 1.0

        for (i in 0 until 1000 * 1000 * 500) {
            a++
            b += a.toLong()
            c *= 0.0000000001f
            d *= 10.0000000001
        }
    }

    external fun test(): Long

    companion object {
        init {
            System.loadLibrary("native-lib")
        }
    }

}
